<template>
  <view class="tipBox">
    <view class="tip" @click="show = !show">
      <view class="icon">?</view>
    </view>
    <text class="content" v-if="show && type == 1">
      {{ content }}
    </text>
    <view class="arrContent" v-if="show && type == 2">
      <text v-for="(item,index) in content" :key="index">{{item}}</text>
    </view>
  </view>
</template>

<script>
export default {
  props: {
    content: {
      type: [String,Array],
      default: "",
    },
    type:{
      type: [String,Number],
      default:'1',
    }
  },
  data() {
    return {
      show:false
    };
  },
};
</script>

<style lang="less" scoped>
.tipBox {
  position: relative;
  margin-left: 10rpx;
  .tip {
    color: #8c8c8c;
    width: 24rpx;
    height: 24rpx;
    border: 1px solid #8c8c8c;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    .icon {
      font-size: 20rpx;
    }
  }
  .content {
    z-index: 100;
    position: absolute;
    left: -30rpx;
    bottom: 40rpx;
    padding: 16rpx;
    width: 380rpx;
    border-radius: 10rpx;
    background-color: rgba(32, 32, 32, 0.92);
    font-size: 28rpx;
    font-family: SF Pro;
    color: #fff;
    ::before {
      position: absolute;
      content: '';
      left: 28rpx;
      bottom: -15rpx;
      border-color: rgba(32, 32, 32, 0.92) #fff #fff #fff;
      border-style: solid;
      border-width: 15rpx 15rpx 0 15rpx;
      height: 0;
      width: 0;
    }
  }
  .arrContent {
    z-index: 100;
    position: absolute;
    display: flex;
    flex-direction: column;
    left: -30rpx;
    bottom: 40rpx;
    padding: 16rpx;
    width: 480rpx;
    border-radius: 10rpx;
    background-color: rgba(32, 32, 32, 0.92);
    font-size: 28rpx;
    font-family: SF Pro;
    color: #fff;
    ::before {
      position: absolute;
      content: '';
      left: 28rpx;
      bottom: -15rpx;
      border-color: rgba(32, 32, 32, 0.92) #fff #fff #fff;
      border-style: solid;
      border-width: 15rpx 15rpx 0 15rpx;
      height: 0;
      width: 0;
    }
  }
}
</style>